package com.aspose.cells;

import java.util.ArrayList;
import java.util.Iterator;

class zarl {
   private zapu a;
   private Worksheet b;
   private Cells c;
   private RowCollection d;
   private zcfx e;
   private int f;
   private int g;
   private int h;
   private int i;
   private int j;
   private Cell k;
   private int l;
   private int m;
   private int n;
   private int o;

   zarl(zapu var1) {
      this.a = var1;
      this.b = var1.i;
      this.c = this.b.getCells();
      this.d = this.b.getCells().getRows();
      PageSetup var2 = var1.i.getPageSetup();
      int[] var3 = zaqh.a(var1.i);
      this.g = var3[0];
      this.i = var3[1];
      this.h = var3[2];
      this.j = var3[3];
      this.a();
   }

   private void a() {
      this.n = this.c.d(0);
      this.o = this.c.b((short)0);

      int var1;
      for(var1 = 0; var1 < this.c.q().getCount(); ++var1) {
         CellArea var2 = this.c.q().a(var1);
         if (var2.EndColumn > this.o) {
            this.o = var2.EndColumn;
         }

         if (var2.EndRow > this.n) {
            this.n = var2.EndRow;
         }
      }

      for(var1 = 0; var1 < this.b.getHyperlinks().getCount(); ++var1) {
         Hyperlink var3 = this.b.getHyperlinks().get(var1);
         if (var3.getArea().StartColumn > this.o) {
            this.o = var3.getArea().StartColumn;
         }

         if (var3.getArea().StartRow > this.n) {
            this.n = var3.getArea().StartRow;
         }
      }

      if (this.b.t() != null && this.b.getShapes().getCount() > 0) {
         for(var1 = 0; var1 < this.b.getShapes().getCount(); ++var1) {
            Shape var4 = this.b.getShapes().get(var1);
            if (var4.getUpperLeftColumn() > this.o) {
               this.o = var4.getUpperLeftColumn();
            }

            if (var4.getUpperLeftRow() > this.n) {
               this.n = var4.getUpperLeftRow();
            }
         }
      }

      this.m = this.o;
      if (this.c.getColumns().getCount() > 0) {
         Column var5 = this.c.getColumns().getColumnByIndex(this.c.getColumns().getCount() - 1);
         if (var5.getIndex() > this.m) {
            this.m = var5.getIndex();
         }
      }

      this.l = this.n;
      if (this.d.getCount() > 0) {
         Row var6 = this.d.getRowByIndex(this.d.getCount() - 1);
         if (var6.getIndex() > this.l) {
            this.l = var6.getIndex();
         }
      }

      if (this.l < this.i) {
         this.l = this.i;
      }

      if (this.m < this.j) {
         this.m = this.j;
      }

   }

   void a(zcfx var1) throws Exception {
      boolean var2 = this.b.t() != null && this.b.t().getCount() > 0;

      try {
         this.c.d = new zkt(this.c, 16383);
         if (var2) {
            this.c.c = new zkx(this.c, 16383);
            this.c.getRows().b(0);
         }

         this.e = var1;
         var1.b("table:table");
         var1.a("table", "name", (String)null, this.a.l);
         var1.a("table", "style-name", (String)null, "ta" + (this.a.i.getIndex() + 1));
         var1.a("table", "print", (String)null, this.a.m);
         String var3 = this.a.i.getPageSetup().getPrintArea();
         if (var3 != null && !"".equals(var3)) {
            var1.a("table", "print-ranges", (String)null, zaqh.a(var3, this.a.l));
         }

         var1.b("office:forms");
         var1.a("form", "automatic-focus", (String)null, "false");
         var1.a("form", "apply-design-mode", (String)null, "false");
         var1.b();
         this.c();
         this.d();
         var1.b();
      } finally {
         this.c.m();
         if (var2) {
            this.c.l();
            this.c.getRows().b();
         }

      }

   }

   private void b() throws Exception {
      if (this.f != 0) {
         for(int var1 = 0; var1 < this.f; ++var1) {
            this.e.b();
         }
      }

      this.f = 0;
   }

   private void c() throws Exception {
      int var1 = this.a.j.b((short)0);
      ColumnCollection var2 = this.a.j.getColumns();
      int var3 = -1;

      for(int var4 = 0; var4 < var2.getCount(); ++var4) {
         Column var5 = var2.getColumnByIndex(var4);
         if (var5.getIndex() - var3 > 1) {
            this.b();
            this.a(var3 + 1, var5.getIndex() - 1);
         }

         int var6 = var5.c();

         int var7;
         for(var7 = var4 + 1; var7 < var2.getCount(); ++var7) {
            Column var8 = var2.getColumnByIndex(var7);
            if (var8.getIndex() - var5.getIndex() != var7 - var4 || !var5.b(var8)) {
               break;
            }
         }

         this.a(var4, var5, var7 - var4);
         var3 = var5.getIndex() + var7 - var4 - 1;
         var4 = var7 - 1;
      }

      this.b();
      if (var2.getCount() == 0) {
         this.a(0, 255);
      } else {
         if (var3 < 255) {
            this.a(var3 + 1, 255);
         }

      }
   }

   void a(int var1, int var2) throws Exception {
      if (this.h != -1) {
         int[] var3 = zaqh.a(var1, var2, this.h, this.j);
         if (var3 != null) {
            if (var3[0] != var1) {
               this.a(var3[0] - var1);
            }

            this.e.b("table:table-header-columns");
            this.a(var3[1] - var3[0] + 1);
            this.e.b();
            if (var3[1] != var2) {
               this.a(var2 - var3[1]);
            }

            return;
         }
      }

      this.a(var2 - var1 + 1);
   }

   private void a(int var1) throws Exception {
      this.e.b("table:table-column");
      this.e.a("table", "style-name", (String)null, this.a.b.b());
      this.e.a("table", "default-cell-style-name", (String)null, "ce15");
      if (var1 != 1) {
         this.e.a("table", "number-columns-repeated", (String)null, zaqh.a(var1));
      }

      this.e.b();
   }

   private zapi a(zaqm var1, int var2, int var3) {
      ArrayList var4 = this.a.b(var2, var3);
      if (var4 != null) {
         zapi var5 = new zapi();
         var5.a = var2;
         var5.b = var3;
         var5.d = var4;
         return var5;
      } else {
         return null;
      }
   }

   private boolean a(zapi var1, int var2, int var3, int var4, int var5) {
      if (var4 == -1) {
         if (var5 != 15) {
            var4 = var5;
         } else {
            int var6 = this.c.getColumns().e(var3);
            if (var6 > -1) {
               var4 = this.c.getColumns().getColumnByIndex(var6).c();
            }
         }
      }

      if (var1.j != var4) {
         return false;
      } else {
         zaqm var10 = this.a.c(var2, var3);
         if (var10 != null) {
            return false;
         } else {
            ArrayList var7 = this.a.b(var2, var3);
            if (var7 != null) {
               return false;
            } else {
               Hyperlink var8 = this.c(var2, var3);
               if (var8 != null) {
                  return false;
               } else {
                  Comment var9 = this.a.a(var2, var3);
                  return var9 == null;
               }
            }
         }
      }
   }

   private zapi a(Row var1, int var2, int var3) {
      zaqm var4 = this.a.c(var2, var3);
      ArrayList var5 = this.a.b(var2, var3);
      Hyperlink var6 = null;
      Comment var7 = null;
      if (var4 == null || var4.c == var3 && var4.a == var2) {
         var6 = this.c(var2, var3);
         var7 = this.a.a(var2, var3);
      }

      if (this.k == null && var4 == null && var5 == null && var6 == null && var7 == null) {
         return null;
      } else {
         zapi var8 = new zapi();
         var8.a = var2;
         var8.b = var3;
         var8.d = var5;
         var8.c = this.k;
         var8.e = var4;
         var8.g = var6;
         var8.h = var7;
         if (var4 != null) {
            ++var3;

            for(; var3 <= var4.d; ++var3) {
               zapi var9 = this.a(var4, var2, var3);
               if (var9 != null) {
                  if (var8.f == null) {
                     var8.f = new zapi[var4.d - var4.c];
                  }

                  var8.f[var3 - var4.c - 1] = var9;
               }
            }
         }

         var8.j = this.k == null ? -1 : this.k.s();
         if (var8.j == -1) {
            if (var1 != null && var1.j()) {
               var8.j = var1.d();
            } else {
               var8.j = this.c.e(var3);
            }
         }

         return var8;
      }
   }

   private void d() throws Exception {
      if (this.c.getColumns().b != null && this.c.getColumns().b.e()) {
         this.c.getColumns().b.c();
      } else {
         boolean var10000 = true;
      }

      int var2 = -1;
      int var3 = 0;
      Workbook var4 = this.c.r().n();
      zr var5 = this.c.f();
      Row var6 = null;
      Row var7 = null;
      zbbj var8 = new zbbj();
      int var11 = -1;
      zahl var12 = null;
      zahl var13 = null;
      Cell var14 = null;
      boolean var15 = true;
      boolean var16 = true;
      int var26;
      if (var5.a() > 0) {
         var12 = var5.a(-1, -1, false);
         var26 = var12.a();
         var7 = new Row(this.c, this.d, var5.f(var26), false);
         var11 = var7.getIndex();
      }

      for(int var17 = 0; var17 <= this.l; ++var17) {
         var4.l();
         var6 = null;
         zbbj var9 = null;
         int var10 = 15;
         if (var11 == var17) {
            var6 = var7;
            var26 = var12.a();
            if (var26 < 0) {
               var7 = null;
               var11 = -1;
            } else {
               var7 = new Row(this.c, this.d, var5.f(var26), false);
               var11 = var7.getIndex();
            }
         } else if (var17 > var11 && var11 > -1) {
            while(true) {
               var26 = var12.a();
               if (var26 < 0) {
                  var7 = null;
                  var11 = -1;
                  break;
               }

               int var18 = var5.a(var26);
               if (var18 == var17) {
                  var6 = new Row(this.c, this.d, var5.f(var26), false);
                  var26 = var12.a();
                  if (var26 < 0) {
                     var7 = null;
                     var11 = -1;
                  } else {
                     var7 = new Row(this.c, this.d, var5.f(var26), false);
                     var11 = var7.getIndex();
                  }
                  break;
               }

               if (var18 > var17) {
                  var7 = new Row(this.c, this.d, var5.f(var26), false);
                  var11 = var7.getIndex();
                  break;
               }
            }
         }

         if (var6 != null) {
            var9 = var6.a.a(var8, 15);
            var10 = var9.d() ? var9.d : 15;
         }

         boolean var27 = false;
         boolean var19 = this.g != -1 && var17 >= this.g && var17 <= this.i;
         if (var19) {
            this.a(var2, var3, var17, var9, var19);
            var2 = var17;
            if (var6 == null) {
               var3 = 0;
            } else {
               var3 = var9.e() & 255;
            }

            var27 = true;
         } else if (var6 != null) {
            if (var17 > this.n && var6.getGroupLevel() == 0) {
               continue;
            }

            this.a(var2, var3, var17, var9, var19);
            var2 = var17;
            var3 = var9.e() & 255;
            var27 = true;
         }

         zapi var20 = null;
         if (var17 <= this.n) {
            int var25 = -1;
            if (var6 != null && var6.a() > 0) {
               var13 = var6.a.a(-1, -1, false);
               var26 = var13.a();
               var14 = new Cell(var6, var26);
               var25 = var14.getColumn();
            }

            for(int var21 = 0; var21 <= this.o; ++var21) {
               this.k = null;
               if (var21 == var25) {
                  this.k = var14;
                  var26 = var13.a();
                  if (var26 < 0) {
                     var14 = null;
                     var25 = -1;
                  } else {
                     var14 = new Cell(var6, var26);
                     var25 = var14.c.a;
                  }
               } else {
                  this.k = null;
                  if (var25 > 0 && var25 < var21) {
                     while(true) {
                        var26 = var13.a();
                        if (var26 < 0) {
                           var14 = null;
                           var25 = -1;
                           break;
                        }

                        int var22 = var6.a.a(var26);
                        if (var22 == var21) {
                           this.k = new Cell(var6, var26);
                           var26 = var13.a();
                           if (var26 < 0) {
                              var14 = null;
                              var25 = -1;
                           } else {
                              var14 = new Cell(var6, var26);
                              var25 = var14.c.a;
                           }
                           break;
                        }

                        if (var22 > var21) {
                           var14 = new Cell(var6, var26);
                           var25 = var14.c.a;
                           break;
                        }
                     }
                  }
               }

               zapi var28 = this.a(var6, var17, var21);
               if (var28 != null) {
                  if (!var27) {
                     this.a(var2, var3, var17, var9, var19);
                     var2 = var17;
                     var3 = 0;
                     var27 = true;
                  }

                  int var23 = var20 == null ? -1 : var20.b();
                  if (var21 != var23 + 1) {
                     this.b(var10, var21 - var23 - 1);
                  }

                  if (var28.c()) {
                     for(int var24 = var21 + 1; var24 <= this.o; ++var24) {
                        if (var25 == var24) {
                           if (!var14.d() || !this.a(var28, var17, var24, var14.s(), var10)) {
                              break;
                           }

                           ++var28.i;
                           var26 = var13.a();
                           if (var26 < 0) {
                              var14 = null;
                              var25 = -1;
                           } else {
                              var14 = new Cell(var6, var26);
                              var25 = var14.c.a;
                           }
                        } else {
                           if (!this.a(var28, var17, var24, -1, var10)) {
                              break;
                           }

                           ++var28.i;
                        }
                     }
                  }

                  this.a(var6, var28, var17, var21);
                  var21 = var28.b();
                  var20 = var28;
               }
            }
         }

         if (var27) {
            if (var20 != null && 255 > var20.b()) {
               if (var10 != 15) {
                  this.b(var10, var20 == null ? 256 : 255 - var20.b());
               } else if (this.a.o) {
                  this.b(15, var20 == null ? 256 : 255 - var20.b());
               }
            }

            if (var19) {
               this.e.b();
            }

            this.e.b();
         }
      }

      this.b();
      if (this.a.o && this.l != 65535) {
         this.c('\uffff' - this.l);
      }

   }

   private boolean a(int var1, int var2, int var3, zbbj var4, boolean var5) throws Exception {
      if (var3 > var1 + 1) {
         this.b();
         this.c(var3 - var1 - 1);
      }

      if (var4 == null) {
         this.b();
         if (var5) {
            this.e.b("table:table-header-rows");
         }

         this.e.b("table:table-row");
         if (this.a.a != null && this.a.a.a() != null) {
            this.e.a("table", "style-name", (String)null, this.a.a.a());
         }

         return var5;
      } else {
         this.a(var1, var2, var4.a, var4.e() & 255);
         if (var5) {
            this.e.b("table:table-header-rows");
         }

         this.e.b("table:table-row");
         this.e.a("table", "style-name", (String)null, this.a.a(var3));
         if (var4.b()) {
            this.e.a("table", "visibility", (String)null, "collapse");
         }

         return var5;
      }
   }

   private void a(Row var1, zapi var2, int var3, int var4) throws Exception {
      if (var2.a()) {
         this.b(var2);
      } else {
         Cell var5 = var2.c;
         this.e.b("table:table-cell");
         if (var2.i > 1) {
            this.e.a("table", "number-columns-repeated", (String)null, zaqh.a(var2.i));
         }

         int var6;
         if (var5 != null) {
            var6 = var5.getType();
            if (var6 == 1 && var5.getDoubleValue() < 0.0D) {
               var6 = 4;
            }

            int var8;
            if (var2.i != 1) {
               this.e.a("table", "style-name", (String)null, "ce" + var5.r());
            } else if (var5.s() == 15) {
               if (var1 != null && var1.j()) {
                  this.e.a("table", "style-name", (String)null, "ce15");
               } else {
                  int var7 = this.c.getColumns().e(var4);
                  if (var7 > -1) {
                     var8 = this.c.getColumns().getColumnByIndex(var7).c();
                     if (var8 != -1 && var8 != 15) {
                        this.e.a("table", "style-name", (String)null, "ce15");
                     }
                  }
               }
            } else if (var2.j != -1) {
               this.e.a("table", "style-name", (String)null, "ce" + var5.r());
            }

            int var9;
            if (var5.f()) {
               if (var5.y()) {
                  if (var5.isArrayHeader()) {
                     this.e.a("table", "formula", (String)null, this.a.k.l + this.a.k.a(var5));
                     zaz var14 = var5.D();
                     var8 = var14.a().EndColumn - var14.a().StartColumn + 1;
                     var9 = var14.a().EndRow - var14.a().StartRow + 1;
                     this.e.a("table", "number-matrix-columns-spanned", (String)null, zaqh.a(var8));
                     this.e.a("table", "number-matrix-rows-spanned", (String)null, zaqh.a(var9));
                  }
               } else {
                  this.e.a("table", "formula", (String)null, this.a.k.l + this.a.k.a(var5));
               }
            }

            if (var2.e != null) {
               this.e.a("table", "number-columns-spanned", (String)null, zaqh.a(var2.e.d - var2.e.c + 1));
               this.e.a("table", "number-rows-spanned", (String)null, zaqh.a(var2.e.b - var2.e.a + 1));
            }

            Hyperlink var15 = var2.g;
            if (var6 != 3) {
               boolean var16;
               var16 = true;
               var9 = this.a.k.h[var5.r()];
               label92:
               switch(var6) {
               case 0:
                  this.e.a("office", "value-type", (String)null, "boolean");
                  this.e.a("office", "boolean-value", (String)null, var5.getBoolValue() ? "true" : "false");
                  break;
               case 1:
                  switch(var9) {
                  case 1:
                     this.e.a("office", "value-type", (String)null, "float");
                     this.e.a("office", "value", (String)null, zaqh.b(var5.getDoubleValue()));
                     break label92;
                  case 2:
                     this.e.a("office", "value-type", (String)null, "date");
                     this.e.a("office", "date-value", (String)null, var5.getDateTimeValue().b("yyyy-MM-dd'T'HH:mm:ss"));
                     break label92;
                  case 3:
                     this.e.a("office", "value-type", (String)null, "time");
                     this.e.a("office", "time-value", (String)null, zaqh.c(var5.getDoubleValue()));
                     break label92;
                  default:
                     this.e.a("office", "value-type", (String)null, "date");
                     this.e.a("office", "date-value", (String)null, var5.getDateTimeValue().b("yyyy-MM-dd'T'HH:mm:ss"));
                     break label92;
                  }
               case 2:
               case 3:
               default:
                  this.e.a("office", "value-type", (String)null, "string");
                  this.e.a("office", "value", (String)null, com.aspose.cells.b.a.zr.a(var5.getValue()));
                  break;
               case 4:
                  switch(var9) {
                  case 0:
                     this.e.a("office", "value-type", (String)null, "currency");
                     this.e.a("office", "value", (String)null, zaqh.b(var5.getDoubleValue()));
                     break label92;
                  case 6:
                     this.e.a("office", "value-type", (String)null, "percentage");
                     this.e.a("office", "value", (String)null, zaqh.b(var5.getDoubleValue()));
                     break label92;
                  default:
                     this.e.a("office", "value-type", (String)null, "float");
                     this.e.a("office", "value", (String)null, zaqh.b(var5.getDoubleValue()));
                     break label92;
                  }
               case 5:
                  this.e.a("office", "value-type", (String)null, "string");
                  if (!var5.I()) {
                     if (var15 != null) {
                        this.e.a("office", "value", (String)null, com.aspose.cells.b.a.zr.a(var5.getValue()));
                     }
                  } else {
                     this.a(var5);
                     var16 = false;
                  }
               }

               if (var16) {
                  int var10 = this.e.g();
                  this.e.a((int)0);
                  this.e.b("text:p");
                  if (var15 == null) {
                     this.e.a(var5.j());
                  } else {
                     this.e.b("text:a");
                     int var11 = var15.a(this.a.i.c());
                     String var12 = var15.getAddress();
                     if (var11 == 2) {
                        var12 = "#" + var12.replace('!', '.');
                     } else if (var11 == 1 && (var12.length() <= 1 || var12.charAt(1) != ':') && !var12.startsWith("\\\\") && var12.indexOf("\\") != -1) {
                        var12 = "../" + com.aspose.cells.b.a.zv.a(var12, "\\", "/");
                     }

                     this.e.a("xlink", "href", (String)null, var12);
                     this.e.a(var5.j());
                     this.e.b();
                  }

                  this.e.b();
                  this.e.a(var10);
               }
            }
         } else {
            if (var2.e != null) {
               this.e.a("table", "number-columns-spanned", (String)null, zaqh.a(var2.e.d - var2.e.c + 1));
               this.e.a("table", "number-rows-spanned", (String)null, zaqh.a(var2.e.b - var2.e.a + 1));
            }

            boolean var13 = true;
            if (var1 != null && var1.j()) {
               var6 = var1.a.i();
            } else {
               var6 = this.c.d.a(var4);
            }

            if (var6 != -1 && var6 != 15) {
               this.e.a("table", "style-name", (String)null, "ce" + var6);
            }
         }

         if (var2.h != null) {
            this.a(var2.h);
         }

         this.d(var2);
         this.e.b();
         this.a(var2);
      }
   }

   private void a(zapi var1) throws Exception {
      if (var1.e != null && var1.e.c != var1.e.d) {
         if (var1.f == null) {
            this.b(var1.e.d - var1.e.c);
         } else {
            int var2 = var1.b;

            for(int var3 = 0; var3 < var1.f.length; ++var3) {
               if (var1.f[var3] != null) {
                  if (var1.f[var3].b != var2 + 1) {
                     this.b(var1.f[var3].b - var2 - 1);
                     var2 = var1.f[var3].b;
                  }

                  this.c(var1.f[var3]);
               }
            }

            if (var2 != var1.e.d) {
               this.b(var1.e.d - var2 - 1);
            }
         }

      }
   }

   private void b(zapi var1) throws Exception {
      int var2 = var1.b - 1;
      if (var1.d != null && var1.d.size() > 0) {
         this.c(var1);
         ++var2;
      }

      int var3;
      if (var1.f == null) {
         var3 = var1.e.d - var1.e.c;
         if (var2 == var1.b - 1) {
            ++var3;
         }

         this.b(var3);
      } else {
         for(var3 = 0; var3 < var1.f.length; ++var3) {
            if (var1.f[var3] != null) {
               if (var1.f[var3].b != var2 + 1) {
                  this.b(var1.f[var3].b - var2 - 1);
               }

               this.c(var1.f[var3]);
               var2 = var1.f[var3].b;
            }
         }

         if (var2 != var1.e.d) {
            this.b(var1.e.d - var2 - 1);
         }

      }
   }

   void a(int var1, Column var2, int var3) throws Exception {
      int var4;
      if (var2.b() == 0) {
         for(var4 = 0; var4 < this.f; ++var4) {
            this.e.b();
         }

         this.f = 0;
      } else if (var1 != 0) {
         Column var6 = this.a.i.getCells().getColumns().getColumnByIndex(var1 - 1);
         int var5;
         if (var6.getIndex() + 1 == var2.getIndex()) {
            if ((var6.b() & 255) > (var2.b() & 255)) {
               this.e.b();
               --this.f;
            } else if ((var6.b() & 255) < (var2.b() & 255)) {
               for(var5 = var6.b() & 255; var5 < (var2.b() & 255); ++var5) {
                  this.e.b("table:table-column-group");
                  ++this.f;
               }
            }
         } else {
            this.b();

            for(var5 = 0; var5 < (var2.b() & 255); ++var5) {
               this.e.b("table:table-column-group");
               ++this.f;
            }
         }
      } else {
         for(var4 = 0; var4 < (var2.b() & 255); ++var4) {
            this.e.b("table:table-column-group");
            ++this.f;
         }
      }

      if (this.h != -1) {
         var4 = var2.getIndex();
         int[] var7 = zaqh.a(var4, var4 + var3 - 1, this.h, this.j);
         if (var7 != null) {
            if (var7[0] != var4) {
               this.a(var2, var7[0] - var4);
            }

            this.e.b("table:table-header-columns");
            this.a(var2, var7[1] - var7[0] + 1);
            this.e.b();
            if (var7[1] != var4 + var3 - 1) {
               this.a(var2, var4 + var3 - var7[1]);
            }

            return;
         }
      }

      this.a(var2, var3);
   }

   private void a(Column var1, int var2) throws Exception {
      this.e.b("table:table-column");
      String var3 = this.a.b(var1.getIndex());
      this.e.a("table", "style-name", (String)null, var3);
      if (var2 != 1) {
         this.e.a("table", "number-columns-repeated", (String)null, zaqh.a(var2));
      }

      int var4 = var1.c();
      this.e.a("table", "default-cell-style-name", (String)null, "ce" + zaqh.a(var4));
      if (var1.isHidden()) {
         this.e.a("table", "visibility", (String)null, "collapse");
      }

      this.e.b();
   }

   private void a(Cell var1) throws Exception {
      zbap var2 = (zbap)var1.c.d;
      String var3 = var2.c;
      byte[] var4 = var2.h();
      int var5 = this.e.g();
      this.e.a((int)0);
      this.e.b("text:p");

      for(int var6 = 0; var6 < var4.length; var6 += 4) {
         int var7 = com.aspose.cells.b.a.zc.e(var4, var6) & '\uffff';
         int var8 = com.aspose.cells.b.a.zc.e(var4, var6 + 2) & '\uffff';
         if (var6 == 0 && var7 > 0) {
            this.e.a(var3.substring(0, 0 + var7));
         }

         if (var7 >= var3.length()) {
            break;
         }

         String var9 = null;
         if (var6 + 4 >= var4.length) {
            var9 = var3.substring(var7);
         } else {
            int var10 = com.aspose.cells.b.a.zc.e(var4, var6 + 4) & '\uffff';
            if (var10 >= var3.length()) {
               var9 = var3.substring(var7);
               var6 = var4.length;
            } else {
               var9 = var3.substring(var7, var7 + (var10 - var7));
            }
         }

         this.e.b("text:span");
         this.e.a("text", "style-name", (String)null, "T" + var8);
         this.e.a(var9);
         this.e.b();
      }

      this.e.b();
      this.e.a(var5);
   }

   private void b(int var1, int var2) throws Exception {
      this.e.b("table:table-cell");
      if (var2 != 1) {
         this.e.a("table", "number-columns-repeated", (String)null, zaqh.a(var2));
      }

      if (var1 != 15) {
         this.e.a("table", "style-name", (String)null, "ce" + zaqh.a(var1));
      }

      this.e.b();
   }

   private void c(zapi var1) throws Exception {
      this.e.b("table:covered-table-cell");
      this.d(var1);
      this.e.b();
   }

   private void b(int var1) throws Exception {
      this.e.b("table:covered-table-cell");
      if (var1 != 1) {
         this.e.a("table", "number-columns-repeated", (String)null, zaqh.a(var1));
      }

      this.e.b();
   }

   private void d(zapi var1) throws Exception {
      if (var1.d != null && var1.d.size() != 0) {
         if (var1.d != null && var1.d.size() > 0) {
            Iterator var2 = var1.d.iterator();

            while(var2.hasNext()) {
               zaqy var3 = (zaqy)var2.next();
               Shape var4 = var3.a;
               switch(var4.getMsoDrawingType()) {
               case 5:
                  this.a((ChartShape)var4, "frame");
                  break;
               case 6:
               case 8:
               case 24:
                  this.a(var3, "frame");
                  break;
               default:
                  this.a(var3, zaqf.b(var3.a.getAutoShapeType()));
               }
            }
         }

      }
   }

   private void a(ChartShape var1, String var2) throws Exception {
      this.e.b("draw:" + var2);
      int var3 = this.b.getIndex() + var1.x();
      int var4 = var3 + 1;
      this.e.a("table", "end-cell-address", (String)null, var1.M().getName() + "." + CellsHelper.cellIndexToName(var1.getLowerRightRow(), var1.getLowerRightColumn()));
      double var5 = var1.getLeftCM();
      double var7 = var1.getTopCM();
      double var9 = (double)var1.getRight();
      double var11 = (double)var1.getBottom();
      this.e.a("svg", "x", (String)null, zaqh.g(var5) + "cm");
      this.e.a("svg", "y", (String)null, zaqh.g(var7) + "cm");
      this.e.a("svg", "width", (String)null, zaqh.g(var1.getWidthCM()) + "cm");
      this.e.a("svg", "height", (String)null, zaqh.g(var1.getHeightCM()) + "cm");
      this.e.a("draw", "z-index", (String)null, zaqh.a(var1.getZOrderPosition()));
      this.e.a("draw", "name", (String)null, var1.getName());
      this.e.a("draw", "style-name", (String)null, "gr" + zaqh.a(var4));
      if ("frame".equals(var2)) {
         this.a(var1);
         this.b(var1);
      }

      this.e.b();
   }

   private void a(ChartShape var1) throws Exception {
      this.e.b("draw:object");
      this.e.a("draw", "notify-on-update-of-ranges", (String)null, this.a(var1.getChart().getNSeries()));
      this.e.a("xlink", "href", (String)null, "./Object " + zaqh.a(var1));
      this.e.a("xlink", "type", (String)null, "simple");
      this.e.a("xlink", "show", (String)null, "embed");
      this.e.a("xlink", "actuate", (String)null, "onLoad");
      this.e.b();
   }

   private void b(ChartShape var1) throws Exception {
      this.e.b("draw:image");
      this.e.a("xlink", "href", (String)null, "./ObjectReplacements/Object " + zaqh.a(var1));
      this.e.a("xlink", "show", (String)null, "embed");
      this.e.a("xlink", "actuate", (String)null, "onLoad");
      this.e.b();
   }

   private void a(zaqy var1, String var2) throws Exception {
      Shape var3 = var1.a;
      this.e.b("draw:" + var2);
      int var4 = this.b.getIndex() + var3.x();
      int var5 = var4 + 1;
      this.e.a("draw", "style-name", (String)null, "S" + zaqh.a(var5));
      this.e.a("draw", "id", (String)null, "id" + zaqh.a(var4));
      this.e.a("draw", "z-index", (String)null, zaqh.a(var3.getZOrderPosition()));
      if (var3.getMsoDrawingType() == 6) {
         this.e.a("xmlns", "presentation", (String)null, "urn:oasis:names:tc:opendocument:xmlns:presentation:1.0");
      }

      this.e.a("draw", "name", (String)null, var3.getName());
      this.e.a("svg", "x", (String)null, zaqh.a((double)var1.a.L().L(), (int)var1.b));
      this.e.a("svg", "y", (String)null, zaqh.a((double)var1.a.L().L(), (int)var1.c));
      this.e.a("svg", "width", (String)null, zaqh.a((double)var1.a.L().L(), (int)var1.e));
      this.e.a("svg", "height", (String)null, zaqh.a((double)var1.a.L().L(), (int)var1.d));
      if ("frame".equals(var2)) {
         switch(var3.getMsoDrawingType()) {
         case 6:
            this.a(var3);
            break;
         case 8:
            this.a(var3, true);
            break;
         case 24:
            this.b(var3);
            this.a(var3, false);
         case 29:
         }
      }

      this.e.b();
   }

   private void a(Shape var1) throws Exception {
      this.e.b("draw:text-box");
      zbtz var2 = var1.aa();
      zarc.a(this.e, var2, "T" + zaqh.a(var2.n()));
      this.e.b();
   }

   private void b(Shape var1) throws Exception {
      this.e.b("draw:object-ole");
      OleObject var2 = (OleObject)var1;
      this.e.a("draw", "class-id", (String)null, com.aspose.cells.b.a.zr.a(var2.t()));
      String var3 = "MSO_OLE_OBJ" + com.aspose.cells.a.c.zp.e(var2.s());
      this.e.a("xlink", "href", (String)null, var3);
      this.e.a("xlink", "show", (String)null, "embed");
      this.e.a("xlink", "actuate", (String)null, "onLoad");
      this.e.b();
   }

   private String a(SeriesCollection var1) {
      String var2 = "";
      String var3 = "";

      for(int var4 = 0; var4 < var1.getCount(); ++var4) {
         if (var1.get(var4).getValues() != null) {
            String var5;
            if (var1.get(var4).getValues().indexOf("$") < 0) {
               var5 = var3 + com.aspose.cells.b.a.zv.a(com.aspose.cells.b.a.zv.a(var1.get(var4).getValues(), "{", ""), "}", "");
               var2 = var2 + var1.get(var4).getValues();
               var3 = ",";
            } else {
               var5 = com.aspose.cells.b.a.zv.a(var1.get(var4).getValues().substring(1), "$", "");
               String[] var6 = com.aspose.cells.b.a.zv.d(var5, '!');
               String var7 = var6[0];
               String[] var8 = com.aspose.cells.b.a.zv.d(var6[1], ':');
               if (var8.length == 1) {
                  var2 = var2 + var7 + "." + var8[0] + ":" + var7 + "." + var8[0] + " ";
               } else {
                  var2 = var2 + var7 + "." + var8[0] + ":" + var7 + "." + var8[1] + " ";
               }
            }
         }
      }

      return var2;
   }

   private void a(Shape var1, boolean var2) throws Exception {
      if (!var2 || ((Picture)var1).getData() != null) {
         this.e.b("draw:image");
         if (var2) {
            Picture var3 = (Picture)var1;
            this.e.a("xlink", "href", (String)null, "Pictures/" + var3.b() + zase.a(var3.getImageFormat()));
         } else {
            OleObject var4 = (OleObject)var1;
            this.e.a("xlink", "href", (String)null, "ObjectReplacements/Object " + var4.e());
         }

         this.e.a("xlink", "show", (String)null, "embed");
         this.e.a("xlink", "actuate", (String)null, "onLoad");
         zbtz var5 = var1.aa();
         zarc.a(this.e, var5, "T" + zaqh.a(var5.n()));
         this.e.b();
      }
   }

   private void c(int var1) throws Exception {
      this.e.b("table:table-row");
      this.e.a("table", "number-rows-repeated", (String)null, zaqh.a(var1));
      this.e.a("table", "style-name", (String)null, this.a.a.a());
      if (this.a.o) {
         this.b(15, 256);
      }

      this.e.b();
   }

   private void a(int var1, int var2, int var3, int var4) throws Exception {
      if (var4 == 0) {
         this.b();
      } else {
         int var5;
         if (var1 > -1) {
            if (var1 + 1 == var3) {
               if (var2 > var4) {
                  this.e.b();
                  --this.f;
               } else if (var2 < var4) {
                  while(var2 < var4) {
                     this.e.b("table:table-row-group");
                     ++this.f;
                     ++var2;
                  }
               }
            } else {
               this.b();

               for(var5 = 0; var5 < var4; ++var5) {
                  this.e.b("table:table-row-group");
                  ++this.f;
               }
            }
         } else {
            for(var5 = 0; var5 < var4; ++var5) {
               this.e.b("table:table-row-group");
               ++this.f;
            }
         }
      }

   }

   private void a(Comment var1) throws Exception {
      String var2 = "";
      this.e.b("office:annotation");
      CommentShape var3 = var1.getCommentShape();
      int var4 = var3.getPlacement();
      var3.setPlacement(0);
      this.e.a("office", "display", (String)null, var1.isVisible() ? "true" : "false");
      this.e.a("draw", "text-style-name", (String)null, var2);
      this.e.a("svg", "width", (String)null, zaqh.a((double)var3.L().L(), var3.getWidth()));
      this.e.a("svg", "height", (String)null, zaqh.a((double)var3.L().L(), var3.getHeight()));
      this.e.a("svg", "x", (String)null, zaqh.a((double)var3.L().L(), var3.getLeftToCorner()));
      this.e.a("svg", "y", (String)null, zaqh.a((double)var3.L().L(), var3.getTopToCorner()));
      zarc.a(this.e, var1.b(), var2);
      var3.setPlacement(var4);
      this.e.b();
   }

   private Hyperlink c(int var1, int var2) {
      HyperlinkCollection var3 = this.a.i.getHyperlinks();

      for(int var4 = 0; var4 < var3.getCount(); ++var4) {
         Hyperlink var5 = var3.get(var4);
         if (var5.getArea().StartRow <= var1 && var5.getArea().EndRow >= var1 && var5.getArea().StartColumn <= var2 && var5.getArea().EndColumn >= var2) {
            return var5;
         }
      }

      return null;
   }
}
